-
Notifications
You must be signed in to change notification settings - Fork 3k
Python: Remove mypy error #4728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| raise NotImplementedError() | ||
|
|
||
| def apply(self, value: S) -> Optional[int]: | ||
| if value is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have S, it can never be None, otherwise, the signature should be Optional[S]. If we want, we can still check if it None, "" or [] using:
if not value:I've removed it for now, because according to the current definition it is unreachable code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, looking at the tests, we might expect a None there. I've changed the code the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, transforms can be applied to optional columns so this should be Optional[S].
c615ced to
1320903
Compare
Mypy complaints about: No [mypy] section in config file Also enabled some additional checks on unreachable code
| return "null" | ||
| return str(value) | ||
| def to_human_string(self, value: Optional[S]) -> str: | ||
| return str(value) if value is not None else "null" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary for this PR? We generally try to avoid code churn that isn't making functional changes.
|
Thanks, @Fokko! |
Mypy complaints about the config file:
Also enabled some additional checks on unreachable code